package leetcode.weekly.week334;

//Solution2Test
public class Solution2 {

	public int[] divisibilityArray(String word, int m) {
		long mod = 0;
		int[] ans = new int[word.length()];
		int i = 0;
		for (char c : word.toCharArray()) {
			int cur = c - '0';
			mod = mod * 10 + cur;
			mod %= m;
			if (mod == 0) {
				ans[i] = 1;
			}
			i++;
		}
		return ans;
	}

}
